package org.happen.android.bean.response;

import org.happen.android.bean.BaseResponse;
import org.happen.android.core.Codes;

import com.google.gson.JsonElement;

public class JsonStrResponse extends BaseResponse
{

	private static final long serialVersionUID = 1L;
	public static final String JSON_DATA = "data";

	/**
	 * json状态码
	 * 
	 * @see Codes.RespCode
	 */
	public int code;

	/**
	 * 提示信息
	 */
	public String error;

	/**
	 * json data
	 */
	// public String dataStr;

	/**
	 * json data
	 */
	public JsonElement data;

	String jsonStr;

	public boolean isSuccess()
	{
		return code == 0;
	}

	public boolean isTokenInvalide()
	{
		return false;
	}

	public String getJsonString()
	{
		if (jsonStr == null && data != null)
		{
			jsonStr = data.toString();
		}
		return jsonStr;
	}

	public String toString()
	{
		return "JsonStrResponse [code=" + code + ", error=" + error + ", data=" + data + "]";
	}
}